<?php
require_once('../../config.php');
Doctrine::loadModels('../../models');

if( $_GET["project_id"]) // AND $_GET["category_id"] AND $_GET["item_desc"] AND $_GET["item_value"])
{
    $project_id = strip_tags($_GET["project_id"]);
    $fin_year_id = strip_tags($_GET["fin_year_id"]);
	$rev_exp_id = strip_tags($_GET["rev_exp_id"]);
	$org_fin_centre_id = strip_tags($_GET["org_fin_centre_id"]);
	$m01_budget = strip_tags($_GET["m01_budget"]);
	$m02_budget = strip_tags($_GET["m02_budget"]);
	$m03_budget = strip_tags($_GET["m03_budget"]);
	$m04_budget = strip_tags($_GET["m04_budget"]);
	$m05_budget = strip_tags($_GET["m05_budget"]);
	$m06_budget = strip_tags($_GET["m06_budget"]);
	$m07_budget = strip_tags($_GET["m07_budget"]);
	$m08_budget = strip_tags($_GET["m08_budget"]);
	$m09_budget = strip_tags($_GET["m09_budget"]);
	$m10_budget = strip_tags($_GET["m10_budget"]);
	$m11_budget = strip_tags($_GET["m11_budget"]);
	$m12_budget = strip_tags($_GET["m12_budget"]);
	$m01_actual = strip_tags($_GET["m01_actual"]);
	$m02_actual = strip_tags($_GET["m02_actual"]);
	$m03_actual = strip_tags($_GET["m03_actual"]);		
	$m04_actual = strip_tags($_GET["m04_actual"]);
	$m05_actual = strip_tags($_GET["m05_actual"]);
	$m06_actual = strip_tags($_GET["m06_actual"]);
	$m07_actual = strip_tags($_GET["m07_actual"]);
	$m08_actual = strip_tags($_GET["m08_actual"]);
	$m09_actual = strip_tags($_GET["m09_actual"]);
	$m10_actual = strip_tags($_GET["m10_actual"]);
	$m11_actual = strip_tags($_GET["m11_actual"]);
	$m12_actual = strip_tags($_GET["m12_actual"]);
	
	file_put_contents  ( "params_insert.txt", 
								"project_id '" .$project_id.
								"' fin_year_id '" .$fin_year_id.
								"' rev_exp_id '" .$rev_exp_id.
								"' org_fin_centre_id '" .$org_fin_centre_id.
								"' m01_budget '" .$m01_budget.
								"' m02_budget '" .$m02_budget.
								"' m03_budget '" .$m03_budget.
								"' m04_budget '" .$m04_budget.
								"' m05_budget '" .$m05_budget.
								"' m06_budget '" .$m06_budget.
								"' m07_budget '" .$m07_budget.
								"' m08_budget '" .$m08_budget.
								"' m09_budget '" .$m09_budget.
								"' m10_budget '" .$m10_budget.
								"' m11_budget '" .$m11_budget.
								"' m12_budget '" .$m12_budget.
								"' m01_actual '" .$m01_actual.
								"' m01_actual '" .$m02_actual.
								"' m01_actual '" .$m03_actual.
								"' m01_actual '" .$m04_actual.
								"' m01_actual '" .$m05_actual.
								"' m01_actual '" .$m06_actual.
								"' m01_actual '" .$m07_actual.
								"' m01_actual '" .$m08_actual.
								"' m01_actual '" .$m09_actual.
								"' m01_actual '" .$m10_actual.
								"' m01_actual '" .$m11_actual.
								"' m01_actual '" .$m12_actual."'");
	//add the budget entry
	$budget = new FinProfitLoss();
	
	$budget->agent_id = $project_id;
	$budget->fin_year_id = $fin_year_id;
	$budget->rev_exp_id = $rev_exp_id;
	$budget->org_fin_centre_id = $org_fin_centre_id;
	$budget->m01_budget = $m01_budget;
	$budget->m02_budget = $m02_budget;
	$budget->m03_budget = $m03_budget;
	$budget->m04_budget = $m04_budget;
	$budget->m05_budget = $m05_budget;
	$budget->m06_budget = $m06_budget;
	$budget->m07_budget = $m07_budget;
	$budget->m08_budget = $m08_budget;
	$budget->m09_budget = $m09_budget;
	$budget->m10_budget = $m10_budget;
	$budget->m11_budget = $m11_budget;
	$budget->m12_budget = $m12_budget;
	$budget->m01_actual = $m01_actual;
	$budget->m02_actual = $m02_actual;
	$budget->m03_actual = $m03_actual;
	$budget->m04_actual = $m04_actual;
	$budget->m05_actual = $m05_actual;
	$budget->m06_actual = $m06_actual;
	$budget->m07_actual = $m07_actual;
	$budget->m08_actual = $m08_actual;
	$budget->m09_actual = $m09_actual;
	$budget->m10_actual = $m10_actual;
	$budget->m11_actual = $m11_actual;
	$budget->m12_actual = $m12_actual;
	$budget->deleted = 0;
	/*
	$budget->created = $created;
	$budget->modified = $modified;
	$budget->created_by = $created_by;
	$budget->modified_by = $modified_by;
	*/	
	$budget->save();
}

?>